
<template>
  <view class="listright">
    <view class="author-img">
      <image :src="list.href" class="img"></image>
      <view class="add" v-show="show" @click="hide" v-if="show">
        <uni-icons type="plusempty" color="white" size="20"></uni-icons>
      </view>
      <view class="reduce" @click="hide" v-else>
        <uni-icons type="checkmarkempty" color="red" size="20"></uni-icons>
      </view>
    </view>
    <view class="right-box">
      <uni-icons
        type="heart-filled"
        size="30"
        :color="color"
        @click="changeColor"
      ></uni-icons>
    </view>
    <view class="number">
      {{ list.like }}
    </view>
    <view class="right-box">
      <uni-icons type="star-filled" color="white" size="30"></uni-icons>
    </view>
    <view class="number">
      {{ list.sms_n }}
    </view>
    <view class="right-box">
      <uni-icons type="redo-filled" color="white" size="30"></uni-icons>
    </view>
    <view class="number">
      {{ list.playNumber }}
    </view>
    <view class="right-box">
      <uni-icons type="chatboxes-filled" color="white" size="30"></uni-icons>
    </view>
    <view class="number">
      {{ list.playNumber }}
    </view>
  </view>
</template>

<script>
export default {
  name: "listright",
  props: {
    item: {
      type: Array,
      required: true,
    },
    num: {
      type: Number,
      required: true,
    },
  },
  //         created(){
  // console.log(this.item);
  //         },
  data() {
    return {
      show: true,
      color: "",
      list: this.item[this.num],
    };
  },
  watch: {
    num() {
      this.list = this.item[this.num];
      console.log(this.list);
    },
  },
  methods: {
    hide() {
		//关注或者不关注
      this.show = !this.show;
    },
    //点击爱心变红（即点赞）或者变白（取消点赞）
    changeColor() {
      console.log(1111);
      this.color = this.color === "" ? "red;" : "";
    },
  },
};
</script>

<style lang="scss" scoped>
.listright {
  width: 50px;
  margin: 0 auto;
}
.author-img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 3px solid #ffffff;
  position: relative;
}
.right-box {
  width: 50px;
  height: 40px;
  margin-top: 13px;
  text-align: center;
  line-height: 40px;
  color: #ffffff;
  font-size: 30px;
}
.img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
}

.number {
  font-size: 10px;
  text-align: center;
  color: #ffffff;
}

.add {
  width: 20px;
  height: 20px;
  background-color: red;
  position: absolute;
  bottom: -9px;
  left: 16px;
  text-align: center;
  line-height: 18px;
  color: #ffffff;
  border-radius: 50%;
}
.reduce {
  width: 20px;
  height: 20px;
  background-color: white;
  position: absolute;
  bottom: -9px;
  left: 16px;
  text-align: center;
  line-height: 18px;
  color: #ffffff;
  border-radius: 50%;
}
</style>

